﻿<Window x:Class="XData.Windows.Client.LoginWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:cs="clr-namespace:XData.Windows.Components;assembly=Windows.Components"
        mc:Ignorable="d"
        cs:WindowAttachedProperties.DialogResult="{Binding DialogResult}"
        FocusManager.FocusedElement="{Binding ElementName=UserTextBox}"
        Title="Login" Height="200" Width="400" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
    <Grid Margin="20">
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
            <RowDefinition Height="auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="auto" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>
        
        <Label Grid.Row="1" Content="User(_U):" HorizontalAlignment="Right" Margin="10" Target="{Binding ElementName=UserTextBox}"/>
        <TextBox x:Name="UserTextBox" Grid.Row="1" Grid.Column="1" Margin="10"  VerticalContentAlignment="Center" TabIndex="0" 
                 Text="{Binding UserName}" />
        
        <Label Grid.Row="2" Content="Password(_P):" HorizontalAlignment="Right" Margin="10" Target="{Binding ElementName=PasswordBox}"/>
        <PasswordBox x:Name="PasswordBox" Grid.Row="2" Grid.Column="1" Margin="10" VerticalContentAlignment="Center" TabIndex="1"
                     cs:PasswordBoxAttachedProperties.Password="{Binding Path=Password, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
        
        <StackPanel Grid.Row="3" Grid.ColumnSpan="2" Orientation="Horizontal" HorizontalAlignment="Right">
            <Button Content="Login" Padding="5" Margin="0,0,10,0" IsDefault="True" TabIndex="2" Command="{Binding LoginCommand}" />
            <Button Content="Exit" Padding="5" Margin="0,0,10,0" TabIndex="3" Command="{Binding ExitCommand}" />
        </StackPanel>
    </Grid>
</Window>
